#include "ProcessPool.hpp"
#include "Task.hpp"
void Usage(std::string proc)
{
    std::cout << "Usage: " << proc << " process-num" << std::endl;
}
 
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        return UsageError;
    }
    int num = std::stoi(argv[1]);

    ProcessPool *pp = new ProcessPool(num, Worker);
    //1.初始化进程池
    pp->InitProcessPool();
    //2.派发任务
    pp->Dispatchtask();
    //3.退出进程池
    pp->CleanProcessPool(); 
    //std::vector<Channel> channels; // 存储可进行写入的管道，相当于组织
    //1.初始化进程池
    //InitProcessPool(num,channels,Worker);

    //DebugPrint(channels);
    //2.派发任务
    //Dispatchtask(channels);
   
    //3.退出进程池
    //CleanProcessPool(channels);
    sleep(5);
    delete pp;
    return 0;
}
